<template>
    <view class="elasticity" :style="{paddingTop: paddingHeight + 'px'}">
        <nav-bar backgroundColor="#fafcff"></nav-bar>
        <view class="k_card">
            <view class="title">{{ leveArticle.title }}</view>
            <view class="author">{{ leveArticle.updateTime }} <text class="readCount">浏览{{ leveArticle.readCount }}</text></view>
            <view class="k_content">
                <u-parse :content="leveArticle.content" :tagStyle="style"></u-parse>
            </view>
        </view>
    </view>
</template>

<script>
import {
    findArticleDetail
} from '@/api/index.js'
export default {
    data () {
        return {
            paddingHeight: uni.getStorageSync('navbarHeight'),
            leve: '',
            params:{
                id:'',
                userId: uni.getStorageSync('userId'),
            },
            leveObj: {
                '1': '高燃脂状态',
                '2': '燃脂状态',
                '3': '中度燃脂状态',
                '4': '低燃脂状态',
                '5': '非燃脂状态',
            },
            leveArticle:{},
            style:{
                h1:'text-align:left;color:#333;margin:46rpx 0 0 0 ;font-size:28rpx',
                h2:'text-align:left;color:#333;margin:46rpx 0 0 0 ;font-size:28rpx',
                h3:'text-align:left;color:#333;margin:46rpx 0 0 0 ;font-size:28rpx',
                h4:'text-align:left;color:#333;margin:46rpx 0 0 0 ;font-size:28rpx',
                h5:'text-align:left;color:#333;margin:46rpx 0 0 0 ;font-size:28rpx',
                p:'text-align:left;',
                text:'text-align:left;display: initial;',
                view:'text-align:left;display:inline-block;',
                ul:'text-align:left;padding:0',
                li:'text-align:left;',
            }
        }
    },
    onLoad (OPTIONS) {
        this.params.id = OPTIONS.id
        this.findArticleDetail()
    },
    methods:{
        findArticleDetail(){
            findArticleDetail(this.params).then((res)=>{
                this.leveArticle = res.data
            }).catch((err)=>{
                
            })
        }
    },
    onShareAppMessage() {
        return {
            title: this.leveArticle.title,
			path: `/pagesB/knowledge/article?id=${this.params.id}`,
			imageUrl: this.leveArticle.coverPic
        }
    },
    onShareTimeline() {
        return {
            title: this.leveArticle.title,
            path: `/pagesB/knowledge/article?id=${this.params.id}`,
			imageUrl: this.leveArticle.coverPic,
        }
    },
}
</script>

<style lang="scss">
page {
    background-color: #fafcff;
    min-height: 100%;
}
text{
    display: initial !important;
}
</style>
<style lang="scss" scoped>
.k_card {
    background-color: #fafcff;
}
.title{
    font-family: PingFang SC, PingFang SC;
    font-weight: 600;
    font-size: 36rpx;
    color: #333333;
    margin-bottom: 12rpx;
    text-align: left;
    padding: 0 32rpx;
}
.author{
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 24rpx;
    color: rgba(31,36,52,0.5);
    text-align: left;
    padding: 0 32rpx;
    .readCount{
        margin-left: 56rpx;
    }
}

.k_content{
    text-align: left;
    font-size: 24rpx;
    color: #666666;
    line-height: 54rpx;
    letter-spacing: 2rpx;
    h4{
        text-align: left;
    }

}

</style>